function refresh_serv(server){
	var window_handle;
	window_handle = window.open ('index.php?update=ok&server='+server,'popupajout', config='height=400, width=600, toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, directories=no, status=no');
	window_handle.close();
	alert("refresh en cours");
}

function refresh_list_server(typed,server){
	window.opener.document.location.href = "index.php?page="+typed+"&server="+server;
}

function vide(name){
	var box=document.getElementsByName(name);
	box[0].value="";
}


function ajax_multiping(arrayaddress){
	for (Address in arrayaddress){
		ajax_ping(arrayaddress[Address]);
	}	
}

function ajax_ping(address){
	//alert(address);
	var xhr;
    if (window.XMLHttpRequest) { 
        xhr = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) {
        xhr = new ActiveXObject("Microsoft.XMLHTTP");
    }
    //on définit l'appel de la fonction au retour serveur
    xhr.onreadystatechange = function() { alert_ajax(xhr,address); };
        
    //on appelle le ping
    xhr.open("GET", "./index.php?ping="+address, true);
    xhr.send(null);
}

function alert_ajax(xhr,address){
	  if (xhr.readyState==4){
		  var castr;
		  var ping;
		  castr = document.getElementById(address);
		  ping = xhr.responseText;
		  //alert(ping);
		  if (ping == "-1"){
			  castr.innerHTML = "Down";
		  }
		  else{
			  castr.innerHTML = ping;
		  }

	  }
}